#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Date          : 2024/10/4
@File          : pandas_start_one.py
@Author        : liwei68
@Description   : 
"""

import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_excel('team.xlsx') # 文件在notebook文件同一目录下

file_path_out = 'team_out.xlsx'
# groupby 分组，sum求和，reset_index重置索引
# 注意 此处如果不重置索引，df中将会没有groupBy的字段
df1 = df.groupby('team').sum('Q1').reset_index()

with pd.ExcelWriter(file_path_out) as writer:
    df1.to_excel(writer, sheet_name='结果', index=False)

print(df1)
df1.plot(x = 'team',y = 'Q1' ,kind = 'hexbin')
plt.plot()
plt.savefig('team.png')